﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Trirand.Web.Mvc;

namespace OneDollarStore.Areas.Admin.Models
{
    public class ProductJqGridModel
    {
        public JQGrid ProductGrid { get; set; }

        // Constructor
        public ProductJqGridModel()
        {
            ProductGrid = new JQGrid
            {
                Columns = new List<JQGridColumn>()
                {
                    new JQGridColumn
                    {
                        DataField = "ProductID",
                        HeaderText="ID",
                        Width = 20,
                        Editable = false,
                        Searchable = false,
                        PrimaryKey = true
                    },
                    new JQGridColumn
                    {
                        DataField = "SerialProductID",
                        HeaderText="Product ID",
                        Width = 20,
                        Editable = true,
                        Searchable = false,
                        EditType = EditType.DropDown
                    },
                    new JQGridColumn
                    {
                        DataField = "Price",
                        Width = 20,
                        Editable = true,
                        DataType = typeof(decimal)
                    },
                    new JQGridColumn
                    {
                        DataField = "Date",
                        Width = 30,
                        Editable = true,
                        DataType = typeof(DateTime)
                    },
                    new JQGridColumn
                    {
                        DataField = "WarrantyTime",
                        Width = 20,
                        Editable = true,
                        DataType = typeof(double)
                    },
                    new JQGridColumn
                    {
                        DataField = "WarrantyCompany",
                        Width = 40,
                        Editable = true,
                        EditType = EditType.TextArea,
                        DataType = typeof(string)
                    },
                    new JQGridColumn
                    {
                        DataField = "Quantity",
                        Width = 30,
                        Editable = true,
                        DataType = typeof(int)
                    }
                },
                Width = Unit.Pixel(1060),
                Height = Unit.Pixel(530)
            };
            ProductGrid.ToolBarSettings.ShowRefreshButton = true;
            ProductGrid.AppearanceSettings.ScrollBarOffset = 30;
        }
    }
}